package com.hcl.orm.core.annotation;

/**
 * @author hucl
 * @projectName jim-orm
 * @description: TODO
 * @date 2021/5/2014:41
 */
public enum DBType {
    /**
     * 所有平台
     */
    ALL("all"),
    /**
     * Oracle
     */
    ORACLE("oracle"),
    /**
     * Mysql类型
     */
    MYSQL("mysql"),
    /**
     * PG
     */
    PG("postgresql"),
    /**
     * OceanBase Oracle
     */
    OB_ORC("oborc"),

    /**
     * OceanBase Mysql
     */
    OB_MYSQL("obmysql");

    private String value;

    DBType(String value) {
        this.value = value;
    }

    public static DBType fromString(String value) {    //将数值转换成枚举值
        switch (value) {
            case "oracle":
                return ORACLE;
            case "mysql":
                return MYSQL;
            case "postgresql":
                return PG;
            case "oborc":
                return OB_ORC;
            case "obmysql":
                return OB_MYSQL;
            default:
                return null;
        }
    }

    public String getValue() {
        return value;
    }
    }
